<template>
<div>
    <el-button @click="offFloor">下架</el-button>
    <!-- <el-button @click="open">修改责任分析师</el-button>
    <el-button>修改分析师</el-button>-->
    <el-table ref="multipleTable" :data="floorTable" tooltip-effect="dark" style="width: 100%" height="300" align="center" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" props="real_estate_id"></el-table-column>
        <el-table-column type="expand">
            <template slot-scope="props">
                <el-form label-position="left" inline class="demo-table-expand">
                    <el-form-item label="楼盘编号">
                        <span>{{ props.row.real_estate_id }}</span>
                    </el-form-item>
                    <el-form-item label="楼盘权重">
                        <span>{{ props.row.property_weight }}</span>
                    </el-form-item>
                    <el-form-item label="浏览量">
                        <span>{{ props.row.views }}</span>
                    </el-form-item>
                    <el-form-item label="责任分析师">
                        <span>{{ props.row.admin_main_analyst }}</span>
                    </el-form-item>
                    <el-form-item label="分析师">
                        <span>{{ props.row.admin_secondary_analyst }}</span>
                    </el-form-item>
                    <el-form-item label="键盘">
                        <span>{{ props.row.admin_edit }}</span>
                    </el-form-item>
                </el-form>
            </template>
        </el-table-column>
        <el-table-column label="楼盘名称" prop="real_estate_name"></el-table-column>
        <el-table-column label="楼盘类型" prop="property_type_name"></el-table-column>
        <el-table-column label="地区" prop="district"></el-table-column>
        <el-table-column label="住宅平均价格" prop="average_price"></el-table-column>
        <el-table-column label="商铺平均价格" prop="average_price"></el-table-column>
        <el-table-column label="写字楼平均价格" prop="average_price"></el-table-column>
        <el-table-column label="操作" prop="state" width="200">
            <template slot-scope="scope">
                <el-select v-model="scope.row.state" @change="gotu(scope.row)" placeholder="楼盘管理" size="mini" style="width: 100px">
                    <el-option v-for="vv in floorSale" :key="vv.id" :label="vv.name" :value="vv.id"></el-option>
                </el-select>
            </template>
        </el-table-column>
    </el-table>
</div>
</template>

<script>
export default {
    props: ["floorTable", "floorSale"],
    data() {
        return {
            // 跳转页面传参这一行数据
            rowData: [],
            // 跳转页面楼盘管理下拉菜单数据
            // tabsData:[],
            csk: [1, 4],
            // 放全选的数组
            multipleSelection: [],
            data: "",
        };
    },
    methods: {
        gotu(row) {
            switch (parseInt(row.state)) {
                case 1:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 2:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 3:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 4:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 5:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 6:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 7:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 8:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 9:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
                case 10:
                    this.$router.push({
                        name: "HouseAdmin",
                        path: "/HouseAdmin",
                        query: {
                            rowData: row,
                        },
                    });
                    break;
            }
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        open() {},
        // 下架按钮
        offFloor() {
            this.$prompt("下架理由", "提示", {
                    confirmButtonText: "确定下架",
                    cancelButtonText: "取消",
                })
                .then(({
                    value
                }) => {
                    this.$message({
                        type: "success",
                        message: "下架成功",
                    });
                })
                .catch(() => {
                    this.$message({
                        type: "info",
                        message: "取消输入",
                    });
                });
        },
    },
    created() {
        // console.log(this.floorTable);
        this.floorTable.forEach((item) => {
            this.$set(this.floorTable, "state", "1");
        });
    },
};
</script>

<style lang="less" scoped>
</style>
